from collections import defaultdict


class Solution:
    def longestPalindrome(self, s: str) -> int:
        mid_dic = defaultdict(int)
        for alpha in s:
            mid_dic[alpha] += 1
        res, flag = 0, False
        for num in mid_dic.values():
            if num % 2 == 1:
                flag = True
            res += (num & 1022)
        res += flag
        return res


a = Solution()
print(a.longestPalindrome("abccccdd"))